﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using WmsApp.WmsService;

namespace WmsApp.Service
{
    public class StockTackingService : IEntityService<StockTacking, StockTackingService>
    {

        #region IEntityService<StockTacking> Members

        public List<StockTacking> GetEntityList()
        {
            var sc = Factory.WmsServiceFactory.GetServiceClient();
            List<StockTacking> list = sc.GetStockTackingList(" and 1=1");
            foreach (var inStoreBill in list)
            {
                inStoreBill.BindPropertyChanged();
            }
            return list;
        }

        public List<StockTacking> GetEntityList(string condition)
        {
            var sc = Factory.WmsServiceFactory.GetServiceClient();
            List<StockTacking> list = sc.GetStockTackingList(condition);
            foreach (var inStoreBill in list)
            {
                inStoreBill.BindPropertyChanged();
            }
            return list;
        }

        public void SaveEntityList(List<StockTacking> list)
        {
            throw new NotImplementedException();
        }

        public StockTacking GetEntity(string key)
        {
            return Factory.WmsServiceFactory.GetServiceClient().GetStockTackingList(
                    String.Format(" and StockTackingNo = '{0}'", key)).FirstOrDefault();
        }

        #endregion
    }
}
